package com.fowo.api.service.handleWork;

import cn.hutool.core.lang.Assert;
import com.fowo.api.entity.ShipPlans;
import com.fowo.api.mapper.ShipPlansMapper;
import com.fowo.api.model.ship.plans.ShipPlansMarkProcessAction;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class ShipPlansMarkProcess implements ShipPlansMarkProcessAction {

    @Resource
    private ShipPlansMapper shipPlansMapper;

    @Override
    public void run(Long id) throws Exception {
        ShipPlans shipPlans = shipPlansMapper.selectById(id);
        Assert.notNull(shipPlans,"此单据不存在");
        Assert.isTrue(shipPlans.getStatus().equals("1"),"单据状态错误");
        shipPlans.setStatus("2");
        shipPlansMapper.updateById(shipPlans);
    }
}
